package com.sskj.phoenixcoin.presenter;

import com.lzy.okgo.OkGo;
import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.common.base.HttpData;
import com.sskj.lib.http.JsonConverter;
import com.sskj.phoenixcoin.activity.AppRecordActivity;
import com.sskj.phoenixcoin.bean.AppRecord;
import com.sskj.phoenixcoin.http.HttpConfig;

import java.util.List;

import io.reactivex.Flowable;


public class AppRecordActivityPresenter extends BasePresenter<AppRecordActivity> {

    public Flowable<List<AppRecord.Record>> getRecord(int page, int size, String stockUserId, int chargeType) {
        return OkGo.<HttpData<AppRecord>>get(HttpConfig.BASE_URL + HttpConfig.APPRECORD)
                .params("page", page)
                .params("pageSize", size)
                .params("systemType", "ANDROID")
                .params("stockUserId", stockUserId)
                .params("chargeType", chargeType)
                .converter(new JsonConverter<HttpData<AppRecord>>() {
                })
                .adapt(new FlowableBody<>())
                .map(appRecordHttpData -> appRecordHttpData.getData().getList());
    }

}
